import React, { Component } from 'react';
import {NavBar} from 'iftide'


export default class Basic extends Component{
    constructor(props) {
        super(props);
        this.state={
            scroll:false
        }
    }

    leftButtonFunc(){
        console.log('left BUTTON click');

    }
    rightButtonFunc(){
        console.log('right BUTTON click');

    }

    listenImgClick(){
        alert('1');
    }

    onLayout=(height)=>{
        console.log(height);
        if(height>25){
            this.setState({scroll:true})
        }
    }

    render() {
        let img = require('../images/myClientServer.png');
        let scroll=this.state.scroll;
        let header1= {
            headerType:'header',
            leftButton: '返回',
            title: 'This is a test title,This is a test title',
            leftButtonFunc:this.leftButtonFunc,
            rightButtonFunc:this.rightButtonFunc,
            rightButtonType:'more',
            listenImg:img,
         
            listenImgClickFunc:this.listenImgClick,
            listenImgStyle:{width:20,height:49,resizeMode:'contain'},
            backgroundColor:'#999',
            //titleFontSize:13,
            onLayout:this.onLayout,
            titleParams:{
                duration:10,
                //conWidth:100,
                scroll:scroll,
                titleStyle:{color:'black',width:'100%'},
                //titleContainerStyle:{backgroundColor:'green',height:40}
            }
        };
        return (
            <NavBar {...header1}/>
        );
    }
}
